package com.atguigu.gmall.product.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.atguigu.gmall.product.entity.BaseAttrValue;
import com.atguigu.gmall.product.service.BaseAttrValueService;
import com.atguigu.gmall.product.mapper.BaseAttrValueMapper;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 *
 */
@Service
public class BaseAttrValueServiceImpl extends ServiceImpl<BaseAttrValueMapper, BaseAttrValue>
    implements BaseAttrValueService{

    @Override
    public List<BaseAttrValue> getAttrValueList(Long attrId) {
        //QueryWrapper<BaseAttrValue> queryWrapper = new QueryWrapper<>();
        //queryWrapper.eq("attr_id", attrId);

        //写法1
        /*LambdaQueryWrapper<BaseAttrValue> queryWrapper = new LambdaQueryWrapper();
        queryWrapper.eq(BaseAttrValue::getAttrId, attrId);//SFunction ::
        List<BaseAttrValue> baseAttrValues = this.list(queryWrapper);*/

        //写法2
        List<BaseAttrValue> baseAttrValues = this.list(new LambdaQueryWrapper<BaseAttrValue>().eq(BaseAttrValue::getAttrId, attrId));
        return baseAttrValues;
    }
}




